home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / pc / windows / qtw_201 / setup / samples / mplayer / framewnd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-19  |  40.6 KB  |  1,111 lines

  1.  
  2. // ---------------------------------------------------------------------
  3. //
  4. // FrameWnd.c - Movie Player - QuickTime for Windows
  5. //
  6. //              Version 1.0
  7. //
  8. //              (c) Copyright 1988-1994 Apple Computer, Inc. All Rights Reserved.
  9. //
  10. // ---------------------------------------------------------------------
  11.  
  12.  
  13. // Includes
  14. // --------
  15. #include <Windows.H>  // Required by Windows
  16. #include <commdlg.h>  // Header file for common dlgs
  17. #include <dlgs.h>     // Header file for common dlgs ids
  18. #include <cderr.h>    // Header file for error ids
  19. #include <memory.h>   // For memset()
  20. #include <shellapi.h> // Required for drag and drop
  21. #include <ver.h>
  22.  
  23. #include <qtole.h> // Interface to qtole dll's
  24.  
  25. #include "fileexts.rh"
  26.  
  27. #include "common.h" // Interface to common.c
  28.  
  29. #include "player.h"  // Interface to other *.c files
  30. #include "player.hr" // Defines used in *.rc files
  31.  
  32.  
  33. // Message-Persistent Data
  34. // -----------------------
  35. static struct // Hungarian notation: g
  36.   { HWND      hwndClient;          // MDI client window
  37.     WORD      wNumMovies;          // Number of movie wnds
  38.     BOOL      bUserAbortPrint;     // User abort print flag
  39.     HWND      hwndCancelPrt;       // Handle of print cancel dlg
  40.     HBITMAP   hAboutBitmap;        // Temp static storage of bitmap
  41.                                    // displayed in about dialogs
  42.     WORD      wTileCascadeArrange; // Indicates tiling, cascading or
  43.                                    // icon arrange
  44.     BOOL      bIconized;           // TRUE while frame wnd is iconized
  45.     BOOL      bRestoring;          // TRUE if restoring iconized frame wnd
  46.   } g;
  47.  
  48.  
  49. // Exported callback functions
  50. // ----------------------------
  51. BOOL __export CALLBACK AboutDlgProc       (HWND, UINT, WPARAM, LPARAM);
  52. BOOL __export CALLBACK CloseEnumProc      (HWND, LPARAM);
  53. BOOL __export CALLBACK MovieEnumProc      (HWND, LPARAM);
  54. BOOL __export CALLBACK PrintCancelDlgProc (HWND, UINT, WPARAM, LPARAM);
  55. int  __export CALLBACK PrintAbortProc     (HDC, int);
  56. UINT __export CALLBACK PrintDlgHookProc   (HWND, UINT, WPARAM, LPARAM);
  57.  
  58. // Internal Function Declarations
  59. // ------------------------------
  60. static LONG NEAR PlayerFrameCreate       (HWND);
  61. static LONG NEAR PlayerFileCommands      (HWND, WPARAM, WORD);
  62. static LONG NEAR PlayerWindowCommands    (HWND, WPARAM, WORD);
  63. static LONG NEAR PlayerHelpCommands      (HWND, WPARAM, WORD);
  64. static LONG NEAR LaunchMovieWnd          (LPSTR, LPSTR);
  65. static VOID NEAR PlayerEnableMenus       (HWND, BOOL);
  66. static VOID NEAR TellUserCommonDlgError  (DWORD);
  67. static LONG NEAR ProcessDroppedFiles     (HWND, WPARAM);
  68. static VOID NEAR DestroyHelpInstance     (HWND);
  69.  
  70. // -----------------------------------------------------------------------
  71.  
  72.  
  73. // Function: PlayerFrameWndProc - Player Frame Window Procedure
  74. // --------------------------------------------------------------------
  75. // Parameters: As required by Microsoft Windows
  76. //
  77. // Returns:    Via DefFrameProc
  78. // --------------------------------------------------------------------
  79. LONG __export CALLBACK PlayerFrameWndProc
  80.     (HWND hwndFrame, UINT message, WPARAM wParam, LPARAM lParam)
  81.  
  82. {
  83.     WNDENUMPROC       lpfnEnumMovies; // -> callback funcion for
  84.                                       // enumeration of movies
  85.     HWND              hwndMovie;      // Temp handle of active movie wnd
  86.     LPQTOLE_OLEDATA   lpOleData;      // -> ole data
  87.  
  88.     switch( message ) {
  89.         case WM_CREATE:
  90.             return PlayerFrameCreate( hwndFrame );
  91.  
  92.         case WM_PALETTECHANGED:
  93.             if( g.wNumMovies &&
  94.                 ( lpfnEnumMovies = (WNDENUMPROC) MakeProcInstance
  95.                 ( (FARPROC) MovieEnumProc, PlayerQueryInstance()))) { // Tell the movie wnds to repaint
  96.                 EnumChildWindows( g.hwndClient, lpfnEnumMovies,
  97.                     (LPARAM) message);
  98.                 FreeProcInstance( (FARPROC) lpfnEnumMovies );
  99.             }
  100.  
  101.             return 0L;
  102.  
  103.         case WM_SIZE:
  104.             if( wParam == SIZE_MINIMIZED ) {
  105.                 g.bIconized  = TRUE;
  106.                 g.bRestoring = FALSE;
  107.             }
  108.             else if( g.bIconized &&
  109.                 (( wParam == SIZE_RESTORED ) ||
  110.                 ( wParam == SIZE_MAXIMIZED ))) {
  111.                 g.bIconized  = FALSE;
  112.                 g.bRestoring = TRUE;
  113.             }
  114.  
  115.         case WM_MOVE:
  116.             if( g.wNumMovies &&
  117.                 ( lpfnEnumMovies = (WNDENUMPROC) MakeProcInstance
  118.                 ( (FARPROC) MovieEnumProc, PlayerQueryInstance()))) { // Tell the movie wnds to reset their grow box bounds rect
  119.                 EnumChildWindows( g.hwndClient, lpfnEnumMovies,
  120.                     (LPARAM) message);
  121.                 FreeProcInstance( (FARPROC) lpfnEnumMovies );
  122.             }
  123.  
  124.             if( g.bRestoring ) {
  125.                 g.bRestoring = FALSE;
  126.             }
  127.  
  128.             break; // break to DefFrameProc
  129.  
  130.  
  131.         case WM_INITMENUPOPUP:
  132.             // Set check marks and enable menu items in popups
  133.             if( !(BOOL) HIWORD( lParam ) &&
  134.                 ( hwndMovie = (HWND) SendMessage
  135.                 ( g.hwndClient, WM_MDIGETACTIVE, 0, 0l )) &&
  136.                 IsWindow( hwndMovie ))
  137.                 SendMessage( hwndMovie, WM_PLAYER_INITPOPUPS, wParam, lParam );
  138.  
  139.             return 0L;
  140.  
  141.         case WM_COMMAND:
  142.             switch( wParam ) {
  143.                 case PLAYER_FILE_OPEN: // file menu popup
  144.                 case PLAYER_FILE_CLOSE:
  145.                 case PLAYER_FILE_PRTSETUP:
  146.                 case PLAYER_FILE_PRINT:
  147.                 case PLAYER_FILE_EXIT:
  148.                     return PlayerFileCommands
  149.                         ( hwndFrame, wParam, HIWORD (lParam));
  150.  
  151.                 case PLAYER_WINDOW_TILE: // window menu popup
  152.                 case PLAYER_WINDOW_CASCADE:
  153.                 case PLAYER_WINDOW_ARRANGE:
  154.                     return PlayerWindowCommands
  155.                         ( hwndFrame, wParam, HIWORD (lParam));
  156.  
  157.  
  158.                 case PLAYER_HELP_PLAYERHELP: // help menu popup
  159.                 case PLAYER_HELP_USINGHELP:
  160.                 case PLAYER_HELP_ABOUTPLAYER:
  161.                     return PlayerHelpCommands
  162.                         ( hwndFrame, wParam, HIWORD( lParam ));
  163.  
  164.                 default:
  165.                     if( ( hwndMovie = (HWND) SendMessage
  166.                         ( g.hwndClient, WM_MDIGETACTIVE, 0, 0L )) &&
  167.                         IsWindow( hwndMovie ))
  168.                         SendMessage( hwndMovie, WM_COMMAND, wParam, lParam );
  169.  
  170.                     break; // break to DefFrameProc
  171.             }
  172.  
  173.             break;
  174.  
  175.         // WM_USER messages
  176.  
  177.         case WM_PLAYER_CMDLINE:
  178.             return LaunchMovieWnd( (LPSTR) lParam, NULL );
  179.  
  180.         case WM_PLAYER_MOVIEDELETED:
  181.             // Decrement movie count. This is incremented in LaunchMovieWnd
  182.             // when movie is created
  183.             if( --g.wNumMovies <= 0 )
  184.                 PlayerEnableMenus( hwndFrame, FALSE );
  185.             return 0L;
  186.  
  187.         // These next messages are posted by the ole callback function in MovieUtl.c
  188.         case WM_PLAYER_OLE_OPTIONSDLG:
  189.             PlayerGetOptions( NULL, (LPQTOLE_OPTIONSMOVIE) lParam );
  190.             return 0L;
  191.  
  192.         case WM_PLAYER_OLE_PLAYOBJECT:
  193.             QTOLE_PlayObject( PlayerQueryOleData(), lParam );
  194.             return 0L;
  195.  
  196.         // end WM_USER messages
  197.  
  198.  
  199.         // Standard drag and drop processing. Allows for multiple movies but
  200.         // does not worry about position of drop
  201.         case WM_DROPFILES:
  202.             return ProcessDroppedFiles( hwndFrame, wParam );
  203.  
  204.         case WM_QUERYENDSESSION:
  205.         case WM_CLOSE:
  206.             if( g.wNumMovies &&
  207.                 ( lpfnEnumMovies = (WNDENUMPROC) MakeProcInstance
  208.                 ( (FARPROC) CloseEnumProc, PlayerQueryInstance()))) { // Give all movies a chance to stop the close
  209.                 EnumChildWindows( g.hwndClient, lpfnEnumMovies, 0L );
  210.                 FreeProcInstance( (FARPROC) lpfnEnumMovies );
  211.  
  212.                 // If someone didn't want to close, don't kill the app
  213.                 if( NULL != GetWindow( g.hwndClient, GW_CHILD ))
  214.                     return 0L;
  215.             }
  216.  
  217.             // Tell qtole.dll that we are closing the server
  218.             // Don't close if QTOLE_ClossingServerWnd returns FALSE;
  219.             if( ( lpOleData = PlayerQueryOleData()) &&
  220.                 lpOleData->lpqtoleServer &&
  221.                 !QTOLE_ClosingServerWnd( lpOleData, message ))
  222.                 return 0L;
  223.  
  224.             break; // break to DefFrameProc
  225.  
  226.         case WM_DESTROY:
  227.             DragAcceptFiles( hwndFrame, FALSE );
  228.  
  229.             // Destroy help instance
  230.             DestroyHelpInstance( hwndFrame );
  231.  
  232.             // NULL the hwnd globals in playmain.c
  233.             PlayerNoMoreWindow();
  234.  
  235.             PostQuitMessage( 0 );
  236.             return 0L;
  237.  
  238.         case WM_NCDESTROY:
  239.             return 0L;
  240.     }
  241.  
  242.     return DefFrameProc
  243.         ( hwndFrame, g.hwndClient, message, wParam, lParam );
  244. }
  245.  
  246.  
  247. // Function: PlayerFrameCreate - process WM_CREATE message
  248. // --------------------------------------------------------------------
  249. // Parameters: HWND hwndFrame;         Frame window
  250. //
  251. // Returns:    0L if OK, else returns -1L to kill app
  252. // --------------------------------------------------------------------
  253. static LONG NEAR PlayerFrameCreate( HWND hwndFrame )
  254.  
  255. {
  256.     CLIENTCREATESTRUCT  clientcreate;  // MDI client create struct
  257.     char                szCaption[50]; // caption buffer;
  258.  
  259.  
  260.     szCaption[0] = '\0';
  261.     if( LoadString( PlayerQueryResources(), PLAYER_STRING_CAPTION,
  262.         szCaption, sizeof( szCaption )))
  263.         SetWindowText( hwndFrame, szCaption );
  264.     // No point in trying for an error message here since it probably won't
  265.     // load either.
  266.  
  267.     // disable menu items until a movie is created
  268.     g.wNumMovies = 0;
  269.     PlayerEnableMenus( hwndFrame, FALSE );
  270.  
  271.     DragAcceptFiles( hwndFrame, TRUE );
  272.  
  273.     clientcreate.hWindowMenu =
  274.         GetSubMenu( GetMenu( hwndFrame ), MENU_WINDOW_POS );
  275.     clientcreate.idFirstChild = PLAYER_CLIENT_FIRSTCHILD;
  276.  
  277.     if( !(g.hwndClient = CreateWindow("MDICLIENT", NULL,
  278.         WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE |
  279.         WS_HSCROLL | WS_VSCROLL,
  280.         0, 0, 0, 0, hwndFrame, ( HMENU) 1,
  281.         PlayerQueryInstance(), (LPVOID) &clientcreate )))
  282.         return -1L; // return -1 to kill app
  283.     else
  284.         return  0L;
  285. }
  286.  
  287.  
  288. // Function: PlayerFileCommands - Process WM_COMMAND, File popup messages
  289. // --------------------------------------------------------------------
  290. // Parameters: HWND   hwndFrame;      Frame window
  291. //             WORD   wIDItem;        Menu or control id
  292. //             WORD   wNotifyCode;    notification message
  293. //
  294. // Returns:    LONG   generally 0L
  295. // --------------------------------------------------------------------
  296. static LONG NEAR PlayerFileCommands
  297.                     (HWND hwndFrame, WPARAM wIDItem, WORD wNotifyCode )
  298.  
  299. {
  300.     HWND           hwndMovie;                 // Handle of movie window
  301.     OPENFILENAME   ofn;                       // OPENFILENAME struct
  302.     char           szMoviePath[256];          // Movie file path
  303.                                               // Must be at least 256 bytes
  304.     char           szMovieName[MAX_NAME_LEN]; // Movie file name
  305.     char           szFilter[256];             // Movie file filter str
  306.     DWORD          dwError;                   // Common dlg error return
  307.     PRINTDLG       pd;                        // Print common dlg struct
  308.     ABORTPROC      lpPrintAbortProc;          // Print abort proc
  309.     DLGPROC        lpPrtCancelProc;           // Print cancel dlg proc
  310.     WORD           wIDError;                  // Resource errror string id
  311.     int            nError;                    // Error return;
  312.     UINT           uSavErrMode;
  313.     HINSTANCE      hLibrary;
  314.  
  315.     static DWORD   nFilterIndex;
  316.  
  317.     typedef UINT ( CALLBACK * PRINTDLGHOOKPROC ) ( HWND, UINT, WPARAM, LPARAM );
  318.     typedef BOOL (FAR PASCAL *PGETOPENFILENAMEPREVIEW) (LPOPENFILENAME lpofn);
  319.  
  320.     PGETOPENFILENAMEPREVIEW pGetOpenFileNamePreview = NULL;
  321.  
  322.  
  323.     switch( wIDItem ) {
  324.         case PLAYER_FILE_OPEN:
  325.             memset( &ofn, 0, sizeof( OPENFILENAME ));
  326.             szMoviePath[0] = '\0';
  327.  
  328.             CommonGetFileFilter (PlayerQueryInstance (), (WORD) COMMON_MOVIES_FILEEXT, 
  329.                 szFilter, sizeof szFilter);
  330.  
  331.             ofn.lStructSize    = sizeof( OPENFILENAME );
  332.             ofn.hwndOwner      = hwndFrame;
  333.             ofn.lpstrFilter    = szFilter;
  334.             ofn.nFilterIndex   = nFilterIndex;
  335.             ofn.lpstrFile      = szMoviePath;
  336.             ofn.nMaxFile       = sizeof( szMoviePath );
  337.             ofn.lpstrFileTitle = szMovieName;
  338.             ofn.nMaxFileTitle  = sizeof( szMovieName );
  339.             ofn.Flags          = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST |
  340.                 OFN_HIDEREADONLY;
  341.  
  342.             uSavErrMode = SetErrorMode (SEM_NOOPENFILEERRORBOX);
  343.  
  344.             if ((hLibrary = LoadLibrary ("msvideo.dll")) >= HINSTANCE_ERROR) {
  345.                 pGetOpenFileNamePreview = (PGETOPENFILENAMEPREVIEW) GetProcAddress (hLibrary, "#252");
  346.                 pGetOpenFileNamePreview = NULL;
  347.             }
  348.  
  349.             if (pGetOpenFileNamePreview != NULL) {
  350.                 if( (*pGetOpenFileNamePreview) ( &ofn )) {
  351.                     nFilterIndex = ofn.nFilterIndex;
  352.                     LaunchMovieWnd( szMoviePath, szMovieName );
  353.                 }
  354.                 else if( dwError = CommDlgExtendedError() ) { // Tell the user about the error
  355.                     TellUserCommonDlgError( dwError );
  356.                 }
  357.             }
  358.  
  359.             else {
  360.                 if( GetOpenFileName ( &ofn )) {
  361.                     nFilterIndex = ofn.nFilterIndex;
  362.                     LaunchMovieWnd( szMoviePath, szMovieName );
  363.                 }
  364.                 else if( dwError = CommDlgExtendedError() ) { // Tell the user about the error
  365.                     TellUserCommonDlgError( dwError );
  366.                 }
  367.             }
  368.  
  369.             if (hLibrary >= HINSTANCE_ERROR)
  370.                 FreeLibrary (hLibrary);
  371.             SetErrorMode (uSavErrMode);
  372.  
  373.             return 0L;
  374.  
  375.         case PLAYER_FILE_CLOSE:
  376.             if( ( hwndMovie = (HWND) SendMessage
  377.                 ( g.hwndClient, WM_MDIGETACTIVE, 0, 0L )) &&
  378.                 IsWindow( hwndMovie ))
  379.                 SendMessage( hwndMovie, WM_CLOSE, 0, 0L );
  380.  
  381.             return 0L;
  382.  
  383.         case PLAYER_FILE_PRTSETUP:
  384.             memset( &pd, 0, sizeof( PRINTDLG ));
  385.  
  386.             pd.lStructSize = sizeof( PRINTDLG );
  387.             pd.hwndOwner   = hwndFrame;
  388.             pd.Flags       = PD_PRINTSETUP;
  389.  
  390.             if( ( PrintDlg( &pd ) == 0 ) &&
  391.                 ( dwError = CommDlgExtendedError() )) { // Tell the user about the error
  392.                 TellUserCommonDlgError( dwError );
  393.             }
  394.  
  395.             return 0L;
  396.  
  397.         case PLAYER_FILE_PRINT:
  398.             memset( &pd, 0, sizeof( PRINTDLG ));
  399.  
  400.             pd.lStructSize = sizeof( PRINTDLG );
  401.             pd.hwndOwner   = hwndFrame;
  402.             pd.Flags       = PD_RETURNDC |
  403.                 PD_ENABLEPRINTHOOK | PD_ENABLEPRINTTEMPLATE;
  404.             pd.hInstance   = PlayerQueryResources();
  405.             pd.lpPrintTemplateName = MAKEINTRESOURCE( CUSTOM_DLG_COMN_PRINT );
  406.             if( !( pd.lpfnPrintHook =  (PRINTDLGHOOKPROC)
  407.                 MakeProcInstance( (FARPROC) PrintDlgHookProc,
  408.                 PlayerQueryInstance()))) {
  409.                 CommonTellUser( PlayerQueryResources(),
  410.                     PLAYER_STRING_NOMEMORY, NULL, MB_OK );
  411.                 return 0L;
  412.             }
  413.  
  414.             if( PrintDlg( &pd ) != 0 ) {
  415.                 lpPrtCancelProc = (DLGPROC) MakeProcInstance
  416.                     ( (FARPROC) PrintCancelDlgProc, PlayerQueryInstance() );
  417.  
  418.                 lpPrintAbortProc = (ABORTPROC) MakeProcInstance
  419.                     ( (FARPROC) PrintAbortProc, PlayerQueryInstance() );
  420.  
  421.                 if( !lpPrtCancelProc || !lpPrintAbortProc ) {
  422.                     CommonTellUser( PlayerQueryResources(),
  423.                         PLAYER_STRING_NOMEMORY, NULL, MB_OK );
  424.                     return 0L;
  425.                 }
  426.  
  427.                 g.bUserAbortPrint = FALSE;
  428.                 nError   = 0;
  429.                 wIDError = 0;
  430.  
  431.                 if( !(g.hwndCancelPrt =
  432.                     CreateDialog( PlayerQueryResources(),
  433.                     MAKEINTRESOURCE( PLAYER_DLG_PRINTCANCEL ),
  434.                     hwndFrame, lpPrtCancelProc ))) {
  435.                     wIDError = PLAYER_STRING_CANCELDLG;
  436.                 }
  437.                 else {
  438.                     EnableWindow( hwndFrame, FALSE ); // disable frame window
  439.                     if( SetAbortProc( pd.hDC, lpPrintAbortProc ) <= 0 )
  440.                         wIDError = PLAYER_STRING_ABORTPROC;
  441.                     else {
  442.                         if( hwndMovie = (HWND) SendMessage
  443.                             ( g.hwndClient, WM_MDIGETACTIVE, 0, 0L ))
  444.                             nError = (int) SendMessage( hwndMovie,
  445.                             WM_PLAYER_PRINTFRAME, 0,
  446.                             (LPARAM) (LPPRINTDLG) &pd );
  447.                         if( ( nError < 0 ) &&
  448.                             ( nError & SP_NOTREPORTED ) &&
  449.                             !g.bUserAbortPrint ) {
  450.                             switch( nError ) {
  451.                                 case SP_APPABORT:
  452.                                 case SP_USERABORT:
  453.                                     break;
  454.                                 case SP_OUTOFDISK:
  455.                                     wIDError = PLAYER_STRING_PRT_OUTOFDISK;
  456.                                     break;
  457.                                 case SP_OUTOFMEMORY:
  458.                                     wIDError = PLAYER_STRING_PRT_NOMEMORY;
  459.                                     break;
  460.                                 case SP_ERROR: // fall through
  461.                                 default:
  462.                                     wIDError = PLAYER_STRING_PRT_GENERROR;
  463.                                     break;
  464.                             }
  465.                         }
  466.                     }
  467.  
  468.                     EnableWindow( hwndFrame, TRUE ); // reenable frame window
  469.  
  470.                     if( g.hwndCancelPrt )
  471.                         DestroyWindow( g.hwndCancelPrt );
  472.                 }
  473.  
  474.                 if( wIDError )
  475.                     CommonTellUser( PlayerQueryResources(), wIDError,
  476.                     PLAYER_STRING_PRT_CAPTION, MB_OK );
  477.  
  478.                 FreeProcInstance( (FARPROC) lpPrtCancelProc );
  479.                 FreeProcInstance( (FARPROC) lpPrintAbortProc );
  480.  
  481.                 if( pd.hDC != NULL )
  482.                     DeleteDC( pd.hDC );
  483.                 if( pd.hDevMode != NULL )
  484.                     GlobalFree( pd.hDevMode );
  485.                 if( pd.hDevNames != NULL )
  486.                     GlobalFree( pd.hDevNames );
  487.  
  488.             }
  489.             else if( dwError = CommDlgExtendedError() ) { // Tell the user about the error
  490.                 TellUserCommonDlgError( dwError );
  491.             }
  492.  
  493.             return 0L;
  494.  
  495.         case PLAYER_FILE_EXIT:
  496.             SendMessage( hwndFrame, WM_CLOSE, 0, 0L );
  497.             return 0L;
  498.     }
  499.  
  500.     return 0L; // should never get here
  501.  
  502. }
  503.  
  504.  
  505. // Function: PlayerWindowCommands - Process WM_COMMAND, Window popup messages
  506. // --------------------------------------------------------------------
  507. // Parameters: HWND   hwndFrame;      Frame window
  508. //             WORD   wIDItem;        Menu or control id
  509. //             WORD   wNotifyCode;    notification message
  510. //
  511. // Returns:    LONG   generally 0L
  512. // --------------------------------------------------------------------
  513. static LONG NEAR PlayerWindowCommands
  514.                     (HWND hwndFrame, WPARAM wIDItem, WORD wNotifyCode )
  515.  
  516. // Tile and cascade are implemented using modifications of
  517. // the standard MDI processing in order to preserve the size
  518. // and aspect ratio of the movies. The modifications are implemented
  519. // in MovieWnd.c on the basis of the value of g.wTileCascadeArrange
  520.  
  521. {
  522.     g.wTileCascadeArrange = wIDItem;
  523.  
  524.     switch( wIDItem ) { // Modify the tile using the WM_WINDOWPOSCHANGING message in
  525.                         // the movie window processing to set the original aspect
  526.                         // ratio and, if possible, size of the movies
  527.         case PLAYER_WINDOW_TILE:
  528.             SendMessage( g.hwndClient, WM_MDITILE, 0, 0L );
  529.             break;
  530.  
  531.         // Modify the cascade using the WM_GETMINMAXINFO message in
  532.         // the movie window processing to preserve the current size
  533.         // of the movies
  534.         case PLAYER_WINDOW_CASCADE:
  535.             SendMessage( g.hwndClient, WM_MDICASCADE, 0, 0L );
  536.             break;
  537.  
  538.         // This is standard MDI.
  539.         case PLAYER_WINDOW_ARRANGE:
  540.             SendMessage( g.hwndClient, WM_MDIICONARRANGE, 0, 0L );
  541.             break;
  542.     }
  543.  
  544.     g.wTileCascadeArrange = 0;
  545.  
  546.     return 0L;
  547.  
  548. }
  549.  
  550.  
  551. // Function: PlayerHelpCommands - Process WM_COMMAND, Help popup messages
  552. // --------------------------------------------------------------------
  553. // Parameters: HWND   hwndFrame;      Frame window
  554. //             WORD   wIDItem;        Menu or control id
  555. //             WORD   wNotifyCode;    notification message
  556. //
  557. // Returns:    LONG   generally 0L
  558. // --------------------------------------------------------------------
  559. static LONG NEAR PlayerHelpCommands
  560.                     (HWND hwndFrame, WPARAM wIDItem, WORD wNotifyCode )
  561.  
  562. {
  563.     char       szHelp[MAX_PATH_LEN]; // Help file path
  564.     DLGPROC    lpDlgProc;            // -> dialog proc
  565.  
  566.     switch( wIDItem ) {
  567.         case PLAYER_HELP_PLAYERHELP:
  568.             CommonGetLocalizedHelpFile
  569.                 ( PLAYER_ROOT_NAME, szHelp, PlayerQueryInstance() );
  570.  
  571.             if( szHelp[0] )
  572.                 WinHelp( hwndFrame, (LPCSTR) szHelp, HELP_CONTENTS, 0L );
  573.             else
  574.                 CommonTellUser( PlayerQueryResources(),
  575.                 PLAYER_STRING_NOHELPFILE,
  576.                 PLAYER_STRING_CAPTION, MB_OK );
  577.  
  578.             return 0L;
  579.  
  580.         case PLAYER_HELP_USINGHELP:
  581.             WinHelp( hwndFrame, "WINHELP.HLP", HELP_CONTENTS, 0L );
  582.             return 0L;
  583.  
  584.         case PLAYER_HELP_ABOUTPLAYER:
  585.             if( ( g.hAboutBitmap = LoadBitmap( PlayerQueryResources(),
  586.                 MAKEINTRESOURCE( PLAYER_PLAYER_BITMAP ))) &&
  587.                 ( lpDlgProc = (DLGPROC) MakeProcInstance
  588.                 ( (FARPROC) AboutDlgProc, PlayerQueryInstance()))) {
  589.                 DialogBox( PlayerQueryResources(),
  590.                     MAKEINTRESOURCE( PLAYER_DLG_ABOUTPLAYER ),
  591.                     hwndFrame, lpDlgProc );
  592.                 FreeProcInstance( (FARPROC) lpDlgProc );
  593.             }
  594.             else
  595.                 CommonTellUser( PlayerQueryResources(),
  596.                 PLAYER_STRING_NOMEMORY,
  597.                 PLAYER_STRING_CAPTION, MB_OK );
  598.             if( g.hAboutBitmap )
  599.                 DeleteObject( g.hAboutBitmap );
  600.             g.hAboutBitmap = NULL;
  601.  
  602.             return 0L;
  603.     }
  604.  
  605.     return 0L; // should never get here
  606.  
  607. }
  608.  
  609. //// the following are some utility routines
  610.  
  611. // Function: CloseEnumProc - Close all enumerate proc
  612. // --------------------------------------------------------------------
  613. // Parameters: As required by Microsoft Windows
  614. //
  615. // Returns:    Always TRUE to enumerate all windows
  616. // --------------------------------------------------------------------
  617. BOOL __export CALLBACK CloseEnumProc( HWND hwnd, LPARAM lParam )
  618.  
  619. {
  620.     char   szClassName[40]; // Temp buffer for class name
  621.  
  622.     // Check class name since there are several classes of child windows
  623.     if( !GetClassName( hwnd, szClassName, sizeof( szClassName )) ||
  624.         lstrcmpi( szClassName, PLAYER_MOVIE_CLASS ))
  625.         return TRUE;
  626.  
  627.     // If  someone doesn't want to close, stop enumeration
  628.     if( !SendMessage( hwnd, WM_QUERYENDSESSION, 0, 0L ))
  629.         return FALSE;
  630.  
  631.     SendMessage( GetParent( hwnd ), WM_MDIDESTROY, (WPARAM) hwnd, 0L );
  632.  
  633.     return TRUE;
  634. }
  635.  
  636. // Function: MovieEnumProc - Tells all movie wnds to do something
  637. // --------------------------------------------------------------------
  638. // Parameters: As required by Microsoft Windows
  639. //
  640. // Returns:    Always TRUE to enumerate all windows
  641. // --------------------------------------------------------------------
  642. BOOL __export CALLBACK MovieEnumProc( HWND hwnd, LPARAM lParam )
  643.  
  644. {
  645.     char    szClassName[40]; // Temp buffer for class name
  646.  
  647.     // Check class name since there are several classes of child windows
  648.     if( !GetClassName( hwnd, szClassName, sizeof( szClassName )) ||
  649.         lstrcmpi( szClassName, PLAYER_MOVIE_CLASS ))
  650.         return TRUE;
  651.  
  652.     if( LOWORD( lParam ) == WM_PALETTECHANGED )
  653.         // Tell the movies to repaint. The background is fixed up in the
  654.         // paint processing
  655.         InvalidateRect( hwnd, NULL, FALSE );
  656.     else if( LOWORD( lParam ) == WM_MOVE ) {
  657.         SendMessage( hwnd, WM_PLAYER_UPDATEGBBOUNDSRECT, 0, 0L );
  658.     }
  659.     else if( LOWORD( lParam ) == WM_SIZE ) {
  660.         SendMessage( hwnd, WM_PLAYER_UPDATEGBBOUNDSRECT, 0, 0L );
  661.         // Tell movies to stop if we are iconizing and to restart
  662.         // if restoring
  663.         if( g.bIconized || g.bRestoring )
  664.             SendMessage( hwnd, WM_PLAYER_PLAYTHEMOVIE,
  665.             (WPARAM ) g.bRestoring, 0L );
  666.     }
  667.  
  668.     return TRUE;
  669. }
  670.  
  671.  
  672. // Function: LaunchMovieWnd - tell hwndClient to launch a movie wnd
  673. // --------------------------------------------------------------------
  674. // Parameters: LPSTR     lpMoviePath      Path of movie file
  675. //             LPSTR     lpName           File name of movie file
  676. //
  677. // Returns:    LONG    0L if OK, else nonzero
  678. // --------------------------------------------------------------------
  679. static LONG NEAR LaunchMovieWnd( LPSTR lpMoviePath, LPSTR lpName )
  680.  
  681. {
  682.     MDICREATESTRUCT    mdicreate; // mdi create struct
  683.     HWND               hwndMovie; // Temp handle of window
  684.  
  685.     if( !lpMoviePath[0] )
  686.         return -1L;
  687.  
  688.     if( lpName == NULL ) {
  689.         lpName = lpMoviePath + lstrlen( lpMoviePath );
  690.         lpName = AnsiPrev( lpMoviePath, lpName );
  691.         while( *lpName && (*lpName != '\\') && (lpName != lpMoviePath))
  692.             lpName = AnsiPrev( lpMoviePath, lpName );
  693.         if( *lpName == '\\' )
  694.             lpName = AnsiNext( lpName );
  695.     }
  696.  
  697.     mdicreate.szClass = PLAYER_MOVIE_CLASS;
  698.     mdicreate.szTitle = AnsiLower( lpName );
  699.     mdicreate.hOwner  = PlayerQueryInstance();
  700.     mdicreate.x       = CW_USEDEFAULT;
  701.     mdicreate.y       = CW_USEDEFAULT;
  702.     mdicreate.cx      = CW_USEDEFAULT;
  703.     mdicreate.cy      = CW_USEDEFAULT;
  704.     mdicreate.style   = 0;
  705.     mdicreate.lParam  = (LPARAM) lpMoviePath;
  706.  
  707.     if( !( hwndMovie = (HWND) SendMessage
  708.         ( g.hwndClient, WM_MDICREATE, 0,
  709.         (LPARAM) (LPMDICREATESTRUCT) &mdicreate ))) {
  710.         return -1L;
  711.     }
  712.     else {
  713.         if(++g.wNumMovies == 1 )
  714.             PlayerEnableMenus( PlayerQueryFrameWindow(), TRUE );
  715.         return 0L;
  716.     }
  717. }
  718.  
  719. // Function: ProcessDroppedFiles - Process the WM_DROPFILES message
  720. // --------------------------------------------------------------------
  721. // Parameters: HWND     hwndFrame         Frame window handle
  722. //             WPARAM   wParam            Message wParam
  723. //
  724. // Returns:    LONG     Always 0L;
  725. // --------------------------------------------------------------------
  726. static LONG NEAR ProcessDroppedFiles( HWND hwndFrame, WPARAM wParam )
  727.  
  728. {
  729.     int           i;                        // Temp counter
  730.     int           nNumFiles;                // Temp number of dropped files
  731.     UINT          uBytes;                   // Temp len of drop file path
  732.     char          szDropFile[MAX_PATH_LEN]; // Temp drop file path
  733.  
  734.     if( nNumFiles = DragQueryFile( (HDROP) wParam, 0xffff,
  735.         (LPSTR) NULL, 0 )) { // Create processing requires that frame window has
  736.                              // nonzero dimensions so first restore iconized wnd
  737.         if( IsIconic( hwndFrame ))
  738.             ShowWindow( hwndFrame, SW_SHOWNORMAL );
  739.  
  740.         for( i=0; i < nNumFiles; i++ ) {
  741.             uBytes = DragQueryFile( (HDROP) wParam, i,
  742.                 (LPSTR) szDropFile, sizeof( szDropFile ));
  743.             if( uBytes > 0 )
  744.                 LaunchMovieWnd( szDropFile, NULL );
  745.         }
  746.     }
  747.  
  748.     DragFinish( (HDROP) wParam );
  749.  
  750.     return 0L;
  751. }
  752.  
  753.  
  754. // Function: DestroyHelpInstance - Tell windows that instance is done with
  755. //                                 help. This is called as a function so that
  756. //                                 szHelp[] is not an automatic var. in the
  757. //                                 winproc
  758. // --------------------------------------------------------------------
  759. // Parameters: HWND     hwndFrame         Frame window handle
  760. //
  761. // Returns:    VOID
  762. // --------------------------------------------------------------------
  763. static VOID NEAR DestroyHelpInstance( HWND hwndFrame )
  764.  
  765. {
  766.     char    szHelp[MAX_PATH_LEN]; // Help file name
  767.  
  768.     WinHelp( hwndFrame, CommonGetLocalizedHelpFile
  769.         ( PLAYER_ROOT_NAME, szHelp, PlayerQueryResources() ),
  770.         HELP_QUIT, NULL );
  771.     return;
  772. }
  773.  
  774.  
  775. // Function: AboutDlgProc - About dialog proc
  776. // --------------------------------------------------------------------
  777. // Parameters: As required by Microsoft Windows
  778. //
  779. // Returns:    As required by Microsoft Windows
  780. // --------------------------------------------------------------------
  781. BOOL __export CALLBACK AboutDlgProc
  782.                   ( HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam )
  783.  
  784. {
  785.     BITMAP       bm;          // Temp bitmap struct
  786.     HWND         hwndCntrl;   // Handle of rect control that is painted
  787.     HDC          hdestDC;     // hdc of control rect
  788.     HDC          hmemDC;      // Memory dc
  789.     RECT         rcdestRect;  // Rect of control
  790.     HBITMAP      hbitmapSave; // Prev bitmap
  791.     PAINTSTRUCT  ps;          // Paint struct
  792.     char         szFormat[80];
  793.     char         szBuffer[80];
  794.     DWORD        handle;
  795.     DWORD        dwSize;
  796.     UINT         uiSize;
  797.     LPBYTE       lpBuffer;
  798.  
  799.     static BYTE  abData[1024];
  800.  
  801.  
  802.     switch( msg ) {
  803.         case WM_COMMAND:
  804.             EndDialog( hdlg, 0 );
  805.             return TRUE;
  806.  
  807.         case WM_INITDIALOG:
  808.             GetModuleFileName (PlayerQueryResources(), szBuffer, sizeof szBuffer);
  809.             dwSize = GetFileVersionInfoSize (szBuffer, &handle);
  810.             GetFileVersionInfo (szBuffer, handle, dwSize, abData);
  811.             VerQueryValue ((VOID FAR *) abData, (LPCSTR) "\\StringFileInfo\\040904E4\\ProductVersion", (VOID FAR * FAR *) &lpBuffer, (UINT FAR *) &uiSize);
  812.             GetDlgItemText (hdlg, ABOUT_VERSION, szFormat, sizeof szFormat);
  813.             wsprintf (szBuffer, szFormat, (LPSTR) lpBuffer);
  814.             SetDlgItemText (hdlg, ABOUT_VERSION, szBuffer);
  815.             GetDlgItemText (hdlg, ABOUT_VERSION_REQUIRES, szFormat, sizeof szFormat);
  816.             wsprintf (szBuffer, szFormat, (LPSTR) lpBuffer);
  817.             SetDlgItemText (hdlg, ABOUT_VERSION_REQUIRES, szBuffer);
  818.             return TRUE;
  819.  
  820.         case WM_PAINT:
  821.             // Don't bother with error messages since only effect is that
  822.             // bitmap will not appear in dialog
  823.             if( !BeginPaint( hdlg, &ps ))
  824.                 return FALSE;
  825.             EndPaint( hdlg, &ps );
  826.  
  827.             if( !g.hAboutBitmap ||
  828.                 !( hwndCntrl = GetDlgItem( hdlg, PLAYER_ABOUT_BMPFRAME )))
  829.                 return FALSE;
  830.  
  831.             InvalidateRect( hwndCntrl, NULL, TRUE );
  832.             UpdateWindow( hwndCntrl );
  833.  
  834.             if( !(hdestDC = GetDC( hwndCntrl )))
  835.                 return FALSE;
  836.  
  837.             if( hmemDC = CreateCompatibleDC( hdestDC )) {
  838.                 if( hbitmapSave = SelectObject( hmemDC, g.hAboutBitmap )) {
  839.                     GetObject( g.hAboutBitmap, sizeof( BITMAP ), &bm );
  840.                     GetClientRect( hwndCntrl, &rcdestRect );
  841.  
  842.                     BitBlt( hdestDC,
  843.                         ( rcdestRect.right - bm.bmWidth ) / 2,
  844.                         ( rcdestRect.bottom - bm.bmHeight ) / 2,
  845.                         bm.bmWidth, bm.bmHeight, hmemDC, 0, 0, SRCCOPY );
  846.  
  847.                     SelectObject( hmemDC, hbitmapSave );
  848.                 }
  849.  
  850.                 DeleteDC( hmemDC );
  851.             }
  852.  
  853.             ReleaseDC( hwndCntrl, hdestDC );
  854.  
  855.             return FALSE;
  856.  
  857.         default:
  858.             return FALSE;
  859.     }
  860.  
  861.     return FALSE;
  862. }
  863.  
  864.  
  865. // Function: PrintAbortProc - Print abort proc
  866. // --------------------------------------------------------------------
  867. // Parameters: As required by Microsoft Windows
  868. //
  869. // Returns:    As required by Microsoft Windows
  870. // --------------------------------------------------------------------
  871. int __export CALLBACK PrintAbortProc( HDC hdc, int nCode )
  872.  
  873. {
  874.     MSG     msg; // Message struct
  875.  
  876.     while( !g.bUserAbortPrint &&
  877.         PeekMessage( &msg, NULL, NULL, NULL, PM_REMOVE )) {
  878.         if( !g.hwndCancelPrt ||
  879.             !IsDialogMessage( g.hwndCancelPrt, &msg )) {
  880.             TranslateMessage( &msg );
  881.             DispatchMessage( &msg );
  882.         }
  883.     }
  884.  
  885.     return !g.bUserAbortPrint;
  886. }
  887.  
  888. // Function: PrintCancelDlgProc - User cancel printing dlg proc
  889. // --------------------------------------------------------------------
  890. // Parameters: As required by Microsoft Windows
  891. //
  892. // Returns:    As required by Microsoft Windows
  893. // --------------------------------------------------------------------
  894. BOOL __export CALLBACK PrintCancelDlgProc
  895.                   ( HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam )
  896.  
  897. {
  898.     char    szName[MAX_NAME_LEN + 1]; // Buffer for movie name
  899.  
  900.     switch( msg ) {
  901.         case WM_INITDIALOG:
  902.             SetFocus( GetDlgItem( hdlg, IDCANCEL ));
  903.             SetDlgItemText( hdlg, PRINT_CANCEL_MOVIENAME,
  904.                 PlayerQueryActiveMovieName( szName ));
  905.             return TRUE;
  906.  
  907.         case WM_COMMAND:
  908.             return ( g.bUserAbortPrint = TRUE );
  909.  
  910.         case WM_DESTROY:
  911.             g.hwndCancelPrt = NULL;
  912.             break;
  913.     }
  914.  
  915.     return FALSE;
  916. }
  917.  
  918. // Function: PrintDlgHookProc - Custom print common dlg hook function
  919. // --------------------------------------------------------------------
  920. // Parameters: As required by Microsoft Windows
  921. //
  922. // Returns:    As required by Microsoft Windows
  923. // --------------------------------------------------------------------
  924. UINT __export CALLBACK PrintDlgHookProc
  925.                 (HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam )
  926.  
  927. { // The dialog ids are defined in dlgs.h
  928.   // Array of ids of controls to be hidden
  929.     static int nIDs[] = {grp1, rad1, rad2, rad3, stc2, edt1,
  930.                          stc3, edt2, chx1, chx2, pshHelp };
  931.     UINT   i; // Temp counter
  932.  
  933.  
  934.     if( message == WM_INITDIALOG ) {
  935.         for( i=0; i < ( sizeof( nIDs ) / sizeof( nIDs[0] )); i++ )
  936.             ShowWindow( GetDlgItem( hdlg, nIDs[i] ), SW_HIDE );
  937.  
  938.         return TRUE;
  939.     }
  940.     else
  941.         return FALSE;
  942. }
  943.  
  944.  
  945. // Function: PlayerEnableMenus - Disables menu items when there
  946. //                               are no movies
  947. // --------------------------------------------------------------------
  948. // Parameters: HWND       hwndFrame      Handle of frame window
  949. //             BOOL       bEnable        Enabling flag
  950. //
  951. // Returns:    VOID
  952. // --------------------------------------------------------------------
  953. static VOID NEAR PlayerEnableMenus( HWND hwndFrame, BOOL bEnable )
  954.  
  955. {
  956.     UINT    fFlag;      // Temp enabling flag
  957.     HMENU   hmenuFrame; // Handle to main menu of frame window
  958.     UINT    i;          // Index
  959.  
  960.     static UINT uMenuIDs[] = {PLAYER_FILE_CLOSE,
  961.                               PLAYER_FILE_PRINT,
  962.  
  963.                               PLAYER_EDIT_COPY,
  964.                               PLAYER_EDIT_OPTIONS,
  965.                               PLAYER_EDIT_CANCELSEL,
  966.  
  967.                               PLAYER_MOVIE_SEARCH,
  968.                               PLAYER_MOVIE_GETINFO,
  969.                               PLAYER_MOVIE_STOPATEND,
  970.                               PLAYER_MOVIE_LOOP,
  971.                               PLAYER_MOVIE_BACKANDFORTH,
  972.                               PLAYER_MOVIE_PLAYSELONLY,
  973.                               PLAYER_MOVIE_HALFSIZE,
  974.                               PLAYER_MOVIE_NORMALSIZE,
  975.                               PLAYER_MOVIE_DOUBLESIZE,
  976.                               PLAYER_MOVIE_SHOWPOSTER,
  977.  
  978.                               PLAYER_WINDOW_TILE,
  979.                               PLAYER_WINDOW_CASCADE,
  980.                               PLAYER_WINDOW_ARRANGE
  981.                              };
  982.  
  983.  
  984.     if( !( hmenuFrame = GetMenu( hwndFrame )))
  985.         return;
  986.  
  987.     fFlag = (bEnable ? MF_ENABLED : MF_GRAYED ) | MF_BYCOMMAND;
  988.     for( i=0; i < sizeof( uMenuIDs ) / sizeof( uMenuIDs[0] ); i++ )
  989.         EnableMenuItem( hmenuFrame, uMenuIDs[i], fFlag );
  990.  
  991.     DrawMenuBar( hwndFrame );
  992.  
  993.     return;
  994. }
  995.  
  996. // Function: TellUserCommonDlgError - Tell the user about the common dlg
  997. //                                    error
  998. // --------------------------------------------------------------------
  999. // Parameters: DWORD       dwError      error code returned by common dlg
  1000. //
  1001. // Returns:    VOID
  1002. // --------------------------------------------------------------------
  1003. static VOID NEAR TellUserCommonDlgError( DWORD dwError )
  1004.  
  1005. {
  1006.     WORD          wIDErrorString; // String id
  1007.  
  1008.     // Not much here now, can make this as explicit as desired
  1009.     // Now returns text of error id, i.e. "CDERR_INITIALIZATION"
  1010.     // Not all messages are explicitly included
  1011.  
  1012.     switch( dwError ) {
  1013.         case CDERR_FINDRESFAILURE:
  1014.             wIDErrorString = PLAYER_STRING_CDLG_FINDRESFAIL;
  1015.             break;
  1016.         case CDERR_INITIALIZATION:
  1017.             wIDErrorString = PLAYER_STRING_CDLG_INITFAIL;
  1018.             break;
  1019.         case CDERR_LOADRESFAILURE:
  1020.             wIDErrorString = PLAYER_STRING_CDLG_LOADRESFAIL;
  1021.             break;
  1022.         case CDERR_LOCKRESFAILURE:
  1023.             wIDErrorString = PLAYER_STRING_CDLG_LOCKRESFAIL;
  1024.             break;
  1025.         case CDERR_MEMALLOCFAILURE:
  1026.             wIDErrorString = PLAYER_STRING_CDLG_MEMALLOCFAIL;
  1027.             break;
  1028.         case CDERR_MEMLOCKFAILURE:
  1029.             wIDErrorString = PLAYER_STRING_CDLG_MEMLOCKFAIL;
  1030.             break;
  1031.         case CDERR_STRUCTSIZE:
  1032.             wIDErrorString = PLAYER_STRING_CDLG_STRUCTSIZE;
  1033.             break;
  1034.         case FNERR_INVALIDFILENAME:
  1035.             wIDErrorString = PLAYER_STRING_CDLG_BADFILENAME;
  1036.             break;
  1037.         case PDERR_INITFAILURE:
  1038.             wIDErrorString = PLAYER_STRING_CDLG_PRTINITFAIL;
  1039.             break;
  1040.         case PDERR_LOADDRVFAILURE:
  1041.             wIDErrorString = PLAYER_STRING_CDLG_LOADDRVFAIL;
  1042.             break;
  1043.         case PDERR_NODEFAULTPRN:
  1044.             wIDErrorString = PLAYER_STRING_CDLG_NODEFPRINTER;
  1045.             break;
  1046.         case PDERR_NODEVICES:
  1047.             wIDErrorString = PLAYER_STRING_CDLG_NODEVICES;
  1048.             break;
  1049.         case PDERR_PRINTERNOTFOUND:
  1050.             wIDErrorString = PLAYER_STRING_CDLG_NOFINDPNTR;
  1051.             break;
  1052.         case PDERR_SETUPFAILURE:
  1053.             wIDErrorString = PLAYER_STRING_CDLG_SETUPFAIL;
  1054.             break;
  1055.         default:
  1056.             wIDErrorString = PLAYER_STRING_CDLG_GENFAILURE;
  1057.             break;
  1058.     }
  1059.  
  1060.     if( wIDErrorString == PLAYER_STRING_CDLG_GENFAILURE )
  1061.         CommonTellUser( PlayerQueryResources(),
  1062.         PLAYER_STRING_CDLG_GENFAILURE,
  1063.         PLAYER_STRING_CDLG_CAP, MB_OK, dwError );
  1064.     else
  1065.         CommonTellUser( PlayerQueryResources(),
  1066.         PLAYER_STRING_CDLG_FORMAT, PLAYER_STRING_CDLG_CAP,
  1067.         MB_OK, wIDErrorString );
  1068.     return;
  1069.  
  1070. }
  1071.  
  1072.  
  1073. //  The remaining functions are the query functions called by other modules
  1074.  
  1075. // Function: PlayerQueryClientWindow - Query Client Window Handle
  1076. // --------------------------------------------------------------------
  1077. // Parameters: None.
  1078. //
  1079. // Returns:    HWND g.hwndClient;        MDI client window handle
  1080. // --------------------------------------------------------------------
  1081. HWND FAR PlayerQueryClientWindow( VOID )
  1082.  
  1083. {
  1084.     return g.hwndClient;
  1085. }
  1086.  
  1087. // Function: PlayerQueryNumMovies - Query number of movies
  1088. // --------------------------------------------------------------------
  1089. // Parameters: None.
  1090. //
  1091. // Returns:    HWND g.wNumMovies;        Number of movies
  1092. // --------------------------------------------------------------------
  1093. WORD FAR PlayerQueryNumMovies( VOID )
  1094.  
  1095. {
  1096.     return g.wNumMovies;
  1097. }
  1098.  
  1099. // Function: PlayerQueryMDIAction - Query tile, cascade or icon arrange.
  1100. // --------------------------------------------------------------------
  1101. // Parameters: None.
  1102. //
  1103. // Returns:    WORD   wTileCascadeArrange    MDI action menu id
  1104. // --------------------------------------------------------------------
  1105. WORD FAR PlayerQueryMDIAction( VOID )
  1106.  
  1107. {
  1108.     return g.wTileCascadeArrange;
  1109. }
  1110.  
  1111.